﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TT.Module.sysLogin;
using System.Data;
using sfcorp.dao;
using SfcorpDLL.ety;
using SQLHelper;

namespace sfcorp.biz
{
    public class bizCustomerClient
    {
        etyBaeSystemParamter basSysParam;
        daoCustomerClient doCustomerClient;

        public bizCustomerClient(etyBaeSystemParamter ieyBasClassDeclare)
        {
            basSysParam = ieyBasClassDeclare;
            doCustomerClient = new daoCustomerClient(basSysParam);
        }
        public daoResult Insert_CustomerClient(etyCustomerClient inEty)
        {
            daoResult rst = doCustomerClient.Insert_CustomerClient(inEty);
            if (rst.Error_String.IndexOf("R_CLIENT_CUSTOMER_U01") >= 0)
            {
                rst.Focus_Control = "txtClient_Id";
                rst.Error_String = "该对应关系已经存在，不能重复设置";
                return rst;
            }
            return rst;
        }

        public daoResult Update_CustomerClient(etyCustomerClient inEty)
        {
            daoResult rst = doCustomerClient.Update_CustomerClient(inEty);
            if (rst.Error_String.IndexOf("R_CLIENT_CUSTOMER_U01") >= 0)
            {
                rst.Focus_Control = "txtClient_Id";
                rst.Error_String = "该对应关系已经存在，不能重复设置";
                return rst;
            }
            return rst;
        }

        public daoResult Delete_CustomerClient(etyCustomerClient inEty)
        {
            return doCustomerClient.Delete_CustomerClient(inEty);
        }


        public IList<etyCustomerClient> Get_CustomerClient(etyCustomerClient inEty)
        {
            DataTable dt = doCustomerClient.Get_CustomerClient(inEty);
            IList<etyCustomerClient> ilRusult = TT.Common.Converts.ConvertToIList<etyCustomerClient>(dt);
            return ilRusult;
        }

    }
}